package com.yw.fileupload.upload.util.file;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ConstantPropertiesUtils implements InitializingBean {

    @Value("${aliyun.oss.file.endpoint}")
    private String endpoint;

    @Value("${aliyun.oss.file.keyId}")
    private String keyId;

    @Value("${aliyun.oss.file.keysecret}")
    private String keySecret;

    @Value("${aliyun.oss.file.bucketname}")
    private String bucketName;

    @Value("${local.path}")
    private String path;

    public static  String EDN_POINT;
    public static  String KEY_ID;
    public static  String KEY_SECRET;
    public static  String BUCKET_NAME;
    public static  String LOCAL_PATH;

    /**
     * 实现InitializingBean 使改文件在spring初始化后加载
     * @throws Exception
     */
    @Override
    public void afterPropertiesSet() throws Exception {

        EDN_POINT=endpoint;
        KEY_ID=keyId;
        KEY_SECRET=keySecret;
        BUCKET_NAME=bucketName;
        LOCAL_PATH=path;
    }
}
